package cn.bingo.yunsj.service;

import cn.bingo.yunsj.common.StateCode;
import cn.bingo.yunsj.common.result.Response;
import cn.bingo.yunsj.controller.model.SerachModel;
import cn.bingo.yunsj.domain.RpNotSend;
import cn.bingo.yunsj.domain.RpSendFail;
import cn.bingo.yunsj.mapper.RpNotSendMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NotSendService {

    @Autowired
    private RpNotSendMapper notSendMapper;

    public Response all() {
        List<RpNotSend> rpNotSends = notSendMapper.selectAll();
        return new Response(StateCode.SEARCH_SUCCESS,(long)rpNotSends.size(),rpNotSends);
    }

    public Response getName() {

        List<RpNotSend> list = notSendMapper.selectName();
        return new Response(StateCode.SEARCH_SUCCESS, (long) list.size(),list);
    }

    public Response search(SerachModel serachModel, String start, String end) {
        if(serachModel.getUserModel()==null){
            serachModel.setUserModel("");
        }

        List<RpNotSend> list = notSendMapper.search(serachModel.getUserModel(), start, end);
        return new Response(StateCode.SEARCH_SUCCESS, (long) list.size(),list);
    }
}
